# !/usr/bin/env python
# coding=utf-8
# @Time    : 2018/8/14 15:35
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/rpc_dao.git
# @File    : insurance_query_service.py
# @Software: PyCharm
# @Version: 2.7.5
from db import insurance_query_dao
from py3_utils import my_thrift
from idl_output.ttypes import InsuranceQueryListDB


def add_ins_qry_list(ins_qry):
	return insurance_query_dao.add_ins_qry_list(ins_qry)


def get_ins_qry_list(user_id):
	orm_data = insurance_query_dao.get_ins_qry_list(user_id)
	if not orm_data:
		return None

	thrift_list = []
	for i in orm_data:
		thrift_data = InsuranceQueryListDB()
		my_thrift.obj_copy_with_same_name(i, thrift_data)
		thrift_list.append(thrift_data)
	return thrift_list


def get_ins_qry_list_Parms(user_id, biz_id):
	orm_data = insurance_query_dao.get_ins_qry_list_Parms(user_id, biz_id)
	if not orm_data:
		return None

	thrift_list = []
	for i in orm_data:
		thrift_data = InsuranceQueryListDB()
		my_thrift.obj_copy_with_same_name(i, thrift_data)
		thrift_list.append(thrift_data)
	return thrift_list